CREATE TABLE [dbo].[tb_TiposDePaquete]
(
[idTipoPaquete] [int] NOT NULL IDENTITY(1, 1),
[Descripcion] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Mnemo] [varchar] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE TRIGGER [dbo].[updatetb_TiposDePaquete] ON [dbo].[tb_TiposDePaquete]
 FOR UPDATE AS 
 IF (update(idTipoPaquete)) begin 
	 SELECT * FROM inserted 
	 IF @@ROWCOUNT = 1 begin 
		 UPDATE tb_PaquetesPlazas
		 SET TipoPaquete = (SELECT idTipoPaquete FROM inserted)
		 WHERE tb_PaquetesPlazas.TipoPaquete = (SELECT idTipoPaquete FROM deleted)
	end  ELSE begin 
		 ROLLBACK TRANSACTION 
 end 
 end
GO
ALTER TABLE [dbo].[tb_TiposDePaquete] ADD CONSTRAINT [PK_tb_TiposDePaquete] PRIMARY KEY NONCLUSTERED  ([idTipoPaquete]) ON [PRIMARY]
GO
